 _town_1 = getMarkerPos "TOWN1"; 
 _town_2 = getMarkerPos "TOWN2"; 
 _town_3 = getMarkerPos "TOWN3"; 
_city1_toggle1 = 0;
_city1_toggle2 = 0;
_city1_toggle3 = 0;
_city2_toggle1 = 0;
_city2_toggle2 = 0;
_city2_toggle3 = 0;
_city3_toggle1 = 0;
_city3_toggle2 = 0;
_city3_toggle3 = 0;
_tm1 = 0;
_tm2 = 0;
_tm3 = 0;
While {true} do { 


if (city1_process == 1 && _city1_toggle1 != 1) then {_tm1 = time + 30;_city1_toggle1 = 1;_city1_toggle2 = 0;_city1_toggle3 = 0;};
if (city1_process == 2 && _city1_toggle2 != 1) then {_tm1 = time + 30;_city1_toggle1 = 0;_city1_toggle2 = 1;_city1_toggle3 = 0;};
if (city1_process == 0 && _city1_toggle3 != 1) then {_tm1 = 0;_city1_toggle1 = 0;_city1_toggle2 = 0; };

if (city2_process == 1 && _city2_toggle1 != 1) then {_tm2 = time + 30;_city2_toggle1 = 1;_city2_toggle2 = 0;_city2_toggle3 = 0;};
if (city2_process == 2 && _city2_toggle2 != 1) then {_tm2 = time + 30;_city2_toggle1 = 0;_city2_toggle2 = 1;_city2_toggle3 = 0;};
if (city2_process == 0 && _city2_toggle3 != 1) then {_tm2 = 0;_city2_toggle1 = 0;_city2_toggle2 = 0; };

if (city3_process == 1 && _city3_toggle1 != 1) then {_tm3 = time + 30;_city3_toggle1 = 1;_city3_toggle2 = 0;_city3_toggle3 = 0;};
if (city3_process == 2 && _city3_toggle2 != 1) then {_tm3 = time + 30;_city3_toggle1 = 0;_city3_toggle2 = 1;_city3_toggle3 = 0;};
if (city3_process == 0 && _city3_toggle3 != 1) then {_tm3 = 0;_city3_toggle1 = 0;_city3_toggle2 = 0; };

if (_tm1 < time && _tm1 != 0) then 
{
	if (city1_process == 2) then {
		 _ls = _town_1 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		if (city1_status == 1) then {
			"TOWN1" setMarkerColor "ColorYellow";
			_city1_toggle2 = 0;
                	city1_status= 0;
	         	publicVariable "city1_status"; 
   		}else{
   			If ( _ce > 0 and _cw == 0) then 
   			{
				"TOWN1" setMarkerColor "ColorRed";
                       	 	city1_status= 2;
				publicVariable "city1_status"; 
   			};
		};

	};
	if (city1_process == 1) then {
		 _ls = _town_1 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		 _cw = WEST countSide _ls; 
		if (city1_status == 2) then {
			"TOWN1" setMarkerColor "ColorYellow";
			_city1_toggle1 = 0;
                	city1_status= 0;
	         	publicVariable "city1_status"; 
   		}else{
  		 	If ( _ce == 0 and _cw > 0) then 
   			{
				"TOWN1" setMarkerColor "ColorBlue";
                        	city1_status= 1;
				publicVariable "city1_status"; 
   			}; 
		};
	};
_tm1 = 0;	
};

if (_tm2 < time && _tm2 != 0) then 
{
	if (city2_process == 2) then {
		 _ls = _town_2 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		if (city2_status == 1) then {
			"TOWN2" setMarkerColor "ColorYellow";
			_city2_toggle2 = 0;
                	city2_status= 0;
	         	publicVariable "city2_status"; 
   		}else{
   			If ( _ce > 0 and _cw == 0) then 
   			{
				"TOWN2" setMarkerColor "ColorRed";
                       	 	city2_status= 2;
				publicVariable "city2_status"; 
   			};
		};

	};
	if (city2_process == 1) then {
		 _ls = _town_2 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		 _cw = WEST countSide _ls; 
		if (city2_status == 2) then {
			"TOWN2" setMarkerColor "ColorYellow";
			_city2_toggle1 = 0;
                	city2_status= 0;
	         	publicVariable "city2_status"; 
   		}else{
  		 	If ( _ce == 0 and _cw > 0) then 
   			{
				"TOWN2" setMarkerColor "ColorBlue";
                        	city2_status= 1;
				publicVariable "city2_status"; 
   			}; 
		};
	};
_tm2 = 0;	
};

if (_tm3 < time && _tm3 != 0) then 
{
	if (city3_process == 2) then {
		 _ls = _town_3 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		if (city3_status == 1) then {
			"TOWN3" setMarkerColor "ColorYellow";
			_city3_toggle2 = 0;
                	city3_status= 0;
	         	publicVariable "city3_status"; 
   		}else{
   			If ( _ce > 0 and _cw == 0) then 
   			{
				"TOWN3" setMarkerColor "ColorRed";
                       	 	city3_status= 2;
				publicVariable "city3_status"; 
   			};
		};

	};
	if (city3_process == 1) then {
		 _ls = _town_3 nearEntities 100; 
  		 _ce = EAST countSide _ls; 
  		 _cw = WEST countSide _ls; 
		 _cw = WEST countSide _ls; 
		if (city3_status == 2) then {
			"TOWN3" setMarkerColor "ColorYellow";
			_city3_toggle1 = 0;
                	city3_status= 0;
	         	publicVariable "city3_status"; 
   		}else{
  		 	If ( _ce == 0 and _cw > 0) then 
   			{
				"TOWN3" setMarkerColor "ColorBlue";
                        	city3_status= 1;
				publicVariable "city3_status"; 
   			}; 
		};
	};
_tm3 = 0;	
};

};